package com.vlin.api.client.request.tuya;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.vlin.api.client.request.ParamsConfig;

public class SimpleParamsConfig implements ParamsConfig {

	private Map<String, String> map = new ConcurrentHashMap<>();
	
	@Override
	public boolean containsKey(String key) {
		
		return map.containsKey(key);
	}

	@Override
	public String getStringValue(String key) {
		
		return map.get(key);
	}

	@Override
	public int getIntValue(String key) {
		String value = map.get(key);
		if(value == null) {
			return 0;
		}
		
		return Integer.valueOf(value);
	}

	@Override
	public boolean getBooleanValue(String key) {
		String value = map.get(key);
		if(value == null) {
			return false;
		}
		return Boolean.valueOf(value);
	}

	@Override
	public long getLongValue(String key) {
		String value = map.get(key);
		if(value == null) {
			return 0;
		}
		return Long.valueOf(value);
	}

	@Override
	public void put(String key, String value) {
		this.map.put(key, value);
		
	}

	@Override
	public boolean notContainsKey(String key) {
		
		return !containsKey(key);
	}

}
